/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import defaultPackage.Vector2;
import model.Player;
import model.Scenario;
import view.GameScreen;

/**
 *
 * @author Marcel
 */
public class Controller {

    private Scenario scenario;
    private Player player;
    private GameScreen gamescreen;

    public Controller(GameScreen gamescreen) {
        this.gamescreen = gamescreen;
        scenario = new Scenario("Images/map.png");
        player = new Player("Images/playerSpaceship.png", new Vector2(gamescreen.getWindow().getWidth()/2, gamescreen.getWindow().getHeight()/2), 1);
    }

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }

    public Scenario getScenario() {
        return scenario;
    }

    public void setScenario(Scenario scenario) {
        this.scenario = scenario;
    }
    
    public void movement (int key) {
        //if (((int)gamescreen.getPlayer().getSprite().x < gamescreen.getWindow().getWidth()) &&
            //((int)gamescreen.getPlayer().getSprite().y < gamescreen.getWindow().getHeight()) && 
            //((int)gamescreen.getPlayer().getSprite().x > 0) &&
           // ((int)gamescreen.getPlayer().getSprite().y > 0))    
                
         //       player.movement(key);
        //else
//        if ((gamescreen.getPlayer().getSprite().x < gamescreen.getWindow().getWidth()))
//                player.movement(key);
//        else
//            player.getPosition().setX(gamescreen.getWindow().getWidth()-1);
//        
//        if ((gamescreen.getPlayer().getSprite().x < 0))
//            player.movement(key);
//        else
//            player.getPosition().setX(1);
//        
//        if ((gamescreen.getPlayer().getSprite().y < gamescreen.getWindow().getHeight()))
//                player.movement(key);
//        else
//            player.getPosition().setY(gamescreen.getWindow().getHeight()-1);
//        
//        if ((gamescreen.getPlayer().getSprite().y < 0))
//            player.movement(key);
//        else
//            player.getPosition().setY(1);
        
        player.movement(key);
            
        
    }
}
